package guestbook;

import javax.jdo.PersistenceManager;

/*
 * this class is a static class has one function: saveInDB
 */
public class DBMethods {
	
	//given an object, this function save the object on the appenging DB
	public static void saveInDB(Object obj,boolean flag){

		if (flag==true){
		
			PersistenceManager pm = PMF.get().getPersistenceManager();
			try 
			{
				pm.makePersistent(obj);
			}
			catch (Exception e)
			{
				e.printStackTrace();
			}
			finally
			{
			pm.close();
			}
		}
		
	}

}
